package com.hammer.example;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.hammer.example.Note;
import com.hammer.example.Lesson;
import com.hammer.example.Zhang;

import com.hammer.example.NoteDao;
import com.hammer.example.LessonDao;
import com.hammer.example.ZhangDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig noteDaoConfig;
    private final DaoConfig lessonDaoConfig;
    private final DaoConfig zhangDaoConfig;

    private final NoteDao noteDao;
    private final LessonDao lessonDao;
    private final ZhangDao zhangDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        noteDaoConfig = daoConfigMap.get(NoteDao.class).clone();
        noteDaoConfig.initIdentityScope(type);

        lessonDaoConfig = daoConfigMap.get(LessonDao.class).clone();
        lessonDaoConfig.initIdentityScope(type);

        zhangDaoConfig = daoConfigMap.get(ZhangDao.class).clone();
        zhangDaoConfig.initIdentityScope(type);

        noteDao = new NoteDao(noteDaoConfig, this);
        lessonDao = new LessonDao(lessonDaoConfig, this);
        zhangDao = new ZhangDao(zhangDaoConfig, this);

        registerDao(Note.class, noteDao);
        registerDao(Lesson.class, lessonDao);
        registerDao(Zhang.class, zhangDao);
    }
    
    public void clear() {
        noteDaoConfig.getIdentityScope().clear();
        lessonDaoConfig.getIdentityScope().clear();
        zhangDaoConfig.getIdentityScope().clear();
    }

    public NoteDao getNoteDao() {
        return noteDao;
    }

    public LessonDao getLessonDao() {
        return lessonDao;
    }

    public ZhangDao getZhangDao() {
        return zhangDao;
    }

}
